#include <stdio.h>
#include <unistd.h>
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "iot_gpio.h"
#include "iot_gpio_ex.h"
#include "iot_pwm.h"
#define fan_GPIO 2
void pwm_Init(){
    IoTGpioInit(fan_GPIO);
    IoTGpioSetFunc(fan_GPIO,IOT_GPIO_FUNC_GPIO_2_PWM2_OUT);
    IoTGpioSetDir(fan_GPIO,IOT_GPIO_DIR_OUT);
    IoTPwmInit(2);
}
void pwm_Set(unsigned short duty,unsigned short freq){
    IoTPwmStart(2, duty, freq);
    printf("fan duty=%d freq=%d",duty,freq);
}
